package org.example.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.bean.condition.TempTableCondition;
import org.example.bean.req.DimensionQuery;
import org.example.bean.req.DynamicViewConfigReq;
import org.example.bean.req.HomePageDataReq;
import org.example.bean.res.DynamicViewConfigRes;
import org.example.bean.res.HomePageDataRes;
import org.example.bean.vo.ConditionVO;
import org.example.dao.mapper.DynamicViewConfigMapper;
import org.example.dao.mapper.DynamicViewGroupMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/home-page-data")
public class HomePageDataController {

    private final DynamicViewConfigMapper dynamicViewConfigMapper;

    @GetMapping("")
    @ApiOperation("获取首页数据")
    public Object queryDynamicViewConfig(HomePageDataReq req) {
        DimensionQuery query = new DimensionQuery();
        query.setDateType(0);
        query.setDrillTable("today_success_detail_info");
        query.setSort(" today_amount desc ");
        query.setDimension("bigArea");
        // query.setProvince();
        // query.setCityGroup();
        // query.setBigArea();
        // query.setCity();
        // query.setCountry();
        // query.setMaintainer();
        // query.setCustomer();
        // query.setObId();
        query.setHasMaintain(false);

        // List<Map<String, Object>> list = dynamicViewConfigMapper.listDynamicInfo(query);

        String ids = "1,2,3";
        List<Map<String, Object>> list = dynamicViewConfigMapper.listDynamicInfo2(ids);
        List<ConditionVO> list1 = dynamicViewConfigMapper.selectConditionVOs();

        TempTableCondition condition = new TempTableCondition();
        condition.setTableName("maintain_map_info");
        condition.setNeStatus("sus");
        Set<Long> longList = dynamicViewConfigMapper.getTempTableMerchantIdsByStatus(condition);

        return longList;
    }
}
